package com.showsu.editor.entity.bigmodel;

import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * @Author: William
 * @Description: https://bigmodel.cn/dev/api/normal-model/glm-4，响应对象
 * @Date: Created in 7:19 下午 2024/10/9
 * @Modified By:
 */
@NoArgsConstructor
@Data
public class ChatCompletionsResponse implements Serializable {

    @SerializedName("choices")
    private List<ChoicesDTO> choices;
    @SerializedName("created")
    private Long created;
    @SerializedName("id")
    private String id;
    @SerializedName("model")
    private String model;
    @SerializedName("request_id")
    private String requestId;
    @SerializedName("usage")
    private UsageDTO usage;

    @NoArgsConstructor
    @Data
    public static class UsageDTO {
        @SerializedName("completion_tokens")
        private Long completionTokens;
        @SerializedName("prompt_tokens")
        private Long promptTokens;
        @SerializedName("total_tokens")
        private Long totalTokens;
    }

    @NoArgsConstructor
    @Data
    public static class ChoicesDTO {
        @SerializedName("finish_reason")
        private String finishReason;
        @SerializedName("index")
        private Integer index;
        @SerializedName("message")
        private MessageDTO message;

        @NoArgsConstructor
        @Data
        public static class MessageDTO {
            @SerializedName("content")
            private String content;
            @SerializedName("role")
            private String role;
        }
    }
}
